package view.screen;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;

import view.base.CanvasScreen;
import base.ScreenActionListener;
import controller.Controller;

public final class WelcomeScreen extends CanvasScreen{
	
	private final int width;
	
	private final int height;
	
	public WelcomeScreen(ScreenActionListener controller){
		super(controller);
		
		width = getWidth();
		
		height = getHeight();
		
		this.addCommand(new Command("Next", Command.OK, 1));

		this.setCommandListener(this);
		
	}
	
	protected void paint(Graphics g) {
		g.setColor(255,255,255);
		g.fillRect(0,0, width, height);
		g.setColor(255, 0, 0);
		g.setFont(Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_BOLD, Font.SIZE_LARGE));
		g.drawString("Welcome to Eagle",width/2,height/2,Graphics.BASELINE|Graphics.HCENTER);
	}

	public void commandAction(Command c, Displayable d) {
		switch (c.getCommandType()) {
		case Command.OK:
			controller.viewAction(Controller.NEXT_COMMAND, null);
			break;
		default:
			super.commandAction(c, d);
			break;
		}
	}
	
}
